home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 2.iso / dist / fw_gimp.idb / usr / freeware / share / gimp / 1.2 / scripts / tileblur.scm.z / tileblur.scm
Text File  |  2002-07-08  |  3KB  |  77 lines

  1. ; Chris Gutteridge (cjg@ecs.soton.ac.uk)
  2. ; At ECS Dept, University of Southampton, England.
  3.  
  4. ; This program is free software; you can redistribute it and/or modify
  5. ; it under the terms of the GNU General Public License as published by
  6. ; the Free Software Foundation; either version 2 of the License, or
  7. ; (at your option) any later version.
  8. ; This program is distributed in the hope that it will be useful,
  9. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11. ; GNU General Public License for more details.
  12. ; You should have received a copy of the GNU General Public License
  13. ; along with this program; if not, write to the Free Software
  14. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15.  
  16.  
  17. (define (script-fu-tile-blur inImage inLayer inRadius inHoriz inVert inType)
  18.  
  19.    (set! theImage inImage)
  20.    (set! theLayer inLayer)
  21.    (set! theHeight (car (gimp-drawable-height theLayer)))
  22.    (set! theWidth (car (gimp-drawable-width theLayer)))
  23.  
  24.    (gimp-image-undo-disable theImage)
  25.    (gimp-layer-resize theLayer (* 3 theWidth) (* 3 theHeight) 0 0)
  26.  
  27.    (gimp-rect-select theImage 0 0 theWidth theHeight REPLACE 0 0)
  28.    (gimp-edit-cut theLayer)
  29.  
  30.    (gimp-selection-none theImage)
  31.    (gimp-layer-set-offsets theLayer theWidth theHeight)
  32.  
  33.    (cjg-pasteat 1 1) (cjg-pasteat 1 2) (cjg-pasteat 1 3)
  34.    (cjg-pasteat 2 1) (cjg-pasteat 2 2) (cjg-pasteat 2 3)
  35.    (cjg-pasteat 3 1) (cjg-pasteat 3 2) (cjg-pasteat 3 3)
  36.  
  37.    (gimp-selection-none theImage)
  38.    (if (= inType 0)
  39.        (plug-in-gauss-iir TRUE theImage theLayer inRadius inHoriz inVert)
  40.        (plug-in-gauss-rle TRUE theImage theLayer inRadius inHoriz inVert)
  41.    )
  42.  
  43.    (gimp-layer-resize theLayer theWidth theHeight (- 0 theWidth) (- 0 theHeight))
  44.    (gimp-layer-set-offsets theLayer 0 0)
  45.    (gimp-image-undo-enable theImage)
  46.    (gimp-displays-flush)
  47. )
  48.  
  49. (define (cjg-pasteat xoff yoff)
  50.    (let     ((theFloat (car(gimp-edit-paste theLayer 0))))
  51.         (gimp-layer-set-offsets theFloat (* xoff theWidth) (* yoff theHeight) )
  52.         (gimp-floating-sel-anchor theFloat)
  53.    )
  54. )
  55.  
  56. ; Register the function with the GIMP:
  57.  
  58. (script-fu-register
  59.     "script-fu-tile-blur"
  60.     _"<Image>/Filters/Blur/Tileable Blur..."
  61.     "Blurs image edges so that the final result tiles seamlessly"
  62.     "Chris Gutteridge"
  63.     "1998, Chris Gutteridge / ECS dept, University of Southampton, England."
  64.     "25th April 1998"
  65.     "RGB*"
  66.     SF-IMAGE "The Image" 0
  67.     SF-DRAWABLE "The Layer" 0
  68.     SF-ADJUSTMENT _"Radius" '(5 0 128 1 1 0 0)
  69.     SF-TOGGLE     _"Blur Vertically" TRUE
  70.     SF-TOGGLE     _"Blur Horizontally" TRUE
  71.     SF-OPTION     _"Blur Type" '(_"IIR" _"RLE")
  72. )
  73.  
  74.  
  75.